package handin06;

import java.util.ArrayList;

/**
 * Supplier delivers product for the VendingMachine
 * @author Peter Tolstrup Aagesen, ptaa@itu.dk
 *
 */

public class Supplier {

	//Constructor
	public Supplier()
	{
		
	}
	
	/**
	 * orderProducts returns an ArrayList of the size and type the 
	 * VendingMachine request
	 * @param type ProductType
	 * @param amount int
	 * @return ArrayList
	 */
	public ArrayList<Product> orderProducts(ProductType type, int amount)
	{
		//Create return ArrayList
		ArrayList<Product> products = new ArrayList<Product>();
		
		//Loop for adding product to the return ArrayList
		for(int i = 0; i < amount; i ++){
			switch(type){
				case APPLE:
					//Add Apple Product
					products.add(new Apple());
					break;
				case COLA:
					//Add Cola Product
					products.add(new Cola());
					break;
				default:
					break;
			}				
		}
		
		//Print order to console
		System.out.println("Supplier recived order for: " + amount + " " + type.toString().toLowerCase() + "s");
		
		//Return ArrayList
		return products;
	}
}
